package com.linxianqin.restTemplate.controller;

import com.linxianqin.restTemplate.model.LoginParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author lxq
 * @version 1.0
 * @description: 模拟另一台服务器接口，可以通过线程名字不同判断
 * @date 2021/1/14 17:05
 */
@Slf4j
@RestController
public class providerController {
    @DeleteMapping("test/delete/{id}")
    @ResponseBody
    public String delete(@PathVariable Integer id) {
        log.info("delete id:{}",id);
        return String.valueOf(id);
    }

    @DeleteMapping("test/delete2")
    @ResponseBody
    public String delete(@RequestParam String name) throws InterruptedException {
        log.info("delete name:{}",name);
        Thread.sleep(10000);
        return name;
    }

    @PutMapping("/user/name")
    @ResponseBody
    public void updateUserByUsername(LoginParam loginParam) {
        log.info("/user/name loginParam:{}",loginParam);
    }
    @PutMapping("/user/address")
    @ResponseBody
    public String updateUserByAddress(@RequestBody LoginParam loginParam) {
        log.info("/user/address loginParam:{}",loginParam);
        return loginParam.toString();
    }
}
